﻿
using CRM.Infrastructure.Dto.Response;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Crm.Service.Instance
{
    public class Base_Service
    {

        /// <summary>
        /// 统一返回值
        /// </summary>
        /// <param name="code"></param>
        /// <param name="message"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public Api_Response_Dto Result(int code, string? message = null, object? data = null)
        {
            return new Api_Response_Dto()
            {
                code = code > 0 ? Api_Code.ok : Api_Code.fail,
                message = message ?? (code > 0 ? "操作成功" : "操作失败"),
                data = data
            };
        }


    }
}
